package com.headwind.logistics.permission.controller;

import com.headwind.logistics.common.util.LayuiUtil;
import com.headwind.logistics.common.pojo.Department;
import com.headwind.logistics.permission.service.intl.DepartmentServiceIntl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 部门控制器层
 */
@Controller
public class DepartmentController {

    //部门业务逻辑层接口
    @Resource
    private DepartmentServiceIntl departmentServiceIntl;

    /**
     * 获取分页部门信息
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("/admin/queryDepartmentPage")
    @ResponseBody
    public LayuiUtil queryDepartmentPage(Integer page,Integer limit){
        //获取分页部门
        List<Department> departments = departmentServiceIntl.queryAllDepartment(page, limit);

        return LayuiUtil.data(departmentServiceIntl.queryAllDepartment(null,null).size(),departments);
    }


}
